package com.rachel.materialdemo.adapter;

import android.support.v7.widget.CardView;
import android.view.View;
import android.widget.ImageView;

import com.rachel.materialdemo.ItemClickListener;
import com.rachel.materialdemo.R;
import com.rachel.materialdemo.bean.Cardtwo;

/**
 * Created by zhengshaorui on 2017/8/22.
 */

public class CardTwoViewholder extends ViewHolderParent<Cardtwo> {
    private ImageView mImageView;
    private CardView mCardView;
    public CardTwoViewholder(View itemView) {
        super(itemView);
        mImageView = (ImageView) itemView.findViewById(R.id.card2_img);
        mCardView = (CardView) itemView.findViewById(R.id.card_ly);
    }

    @Override
    public void onBindView(Cardtwo data, final int position, final ItemClickListener listener) {
        mImageView.setImageResource(data.getResid());
        mCardView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                listener.onItemClickListener(v,position);
            }
        });
    }


}
